package snap;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.concurrent.ConcurrentHashMap;

import data.Node;

public class Snap {
	public static void write(ConcurrentHashMap<String, Node> data) throws FileNotFoundException, IOException {
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("c:/abc.dat")));
		oos.writeObject(data);
		oos.close();
	}

	public static ConcurrentHashMap<String, Node> read() throws FileNotFoundException, IOException, ClassNotFoundException {
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("c:/abc.dat")));
		ConcurrentHashMap<String, Node> data = (ConcurrentHashMap<String, Node>) ois.readObject();
		ois.close();
		return data;
	}
}